<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>构造函数</title>
		<script>
			//需求 ：创建几个用户对象，有用户名，密码，方法：读取用户名和密码
			//工厂模式
			function yong(ming,ma){
				var hu = {
					name:ming,
					password:ma,
					say:function(){
						alert(this.name + this.password);
					}
				}
				return hu;
			}
			
			var yonghu1 = yong("哔哔","1234abcd");
			var yonghu2 = yong("狸狸","123456alili");
			
		  //构造函数
		  function User(zi,mi){
		  	this.name = zi;
		  	this.password = mi;
		  	this.say = function(){
		  		alert(this.name + this.password);
		  	}
		  }
		   var yonghu3 = new User("王伟
		   ","23432sfvg");
		   yonghu3.say();
		</script>
	</head>
	<body>
	</body>
</html>
